<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('setting',$postdata);
		exi('设置成功');
	}
	$footernav =array(
		array('title'=>'代理中心','icon'=>'icon-shouye','action'=>'jy_dayfee/index/'),
		array('title'=>'分红','icon'=>'icon-yiban','action'=>'jy_dayfee/commission/'),
		array('title'=>'收益订单','icon'=>'icon-dingdan','action'=>'jy_dayfee/order/'),
		array('title'=>'我的直招','icon'=>'icon-paihao0','action'=>'jy_dayfee/down/'),
	);	
	$return['item']=$this->plugin_setting('setting');
	$return['item']['footernav']=$return['item']['footernav']?:$footernav;
	$return['feetotal_types']=$this->feetotal_types;
	$return['fenxiaototal_types']=$this->fenxiaototal_types;
	$fenset=array();
	foreach($this->level_types as $k=>$value){
		$fenset[]=array('nodel'=>1,'key'=>$k,'title'=>$value,'feerate'=>$k.'%','tuifee0'=>$k.'%','tuifee1'=>$k.'%','jifen2'=>$k.'%');
	}
	$return['item']['fenset']=$return['item']['fenset']?:$fenset;
	foreach($return['item']['fenset'] as &$value){
		$value['nodel']=1;
	}
	$aitip='启用后才生效！';
    if($_SESSION['isfounder']){
        $aitip.='</br>【务必】添加计划任务，否则自动广告值释放，贡献值释放等不正常（管理员可操作）！：
			</br>[注意]：<red>每次执行间隔时间不能低于24小时（设置每天执行一次），建议凌晨0小时10分钟启动。</red>
			</br>1、计划任务：系统--云服务--计划任务;任务URL：jy_dayfee/plan/
		';
    }
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基础设置',
				'list'=>array(
					array('type'=>'tip','title'=>$aitip),
					array('type'=>'switch','title'=>'是否启用','name'=>'isopen'),
					array('type'=>'radio','title'=>'成为代理商条件','name'=>'become','options'=>'become'),
					array('type'=>'unitstring','unit'=>'元','title'=>'消费满N元成为代理商','name'=>'become_orderprice','show'=>array('become'=>4)),
					//array('type'=>'radio','title'=>'代理模式','name'=>'agent_type','options'=>'agent_types','help'=>'独家代理：同一个地区只能存在一个代理；普通代理：同一个地区可存在多个代理！'),
					//array('type'=>'switch','title'=>'同时代理多个地区','name'=>'agent_many','help'=>'开启后，一个代理商可同时代理多个地区'),
					array('type'=>'checkbox','title'=>'代理商升级考核指标','name'=>'level_up_types','options'=>'leveltype'),
					array('type'=>'checkbox','title'=>'佣金计算方式','name'=>'fenxiaototal_types','options'=>'fenxiaototal_types'),	
					array('type'=>'switch','title'=>'是否启用广告值提现到通证账户','name'=>'is_openti','isradio'=>'1'),
					array('type'=>'unitstring','unit'=>'元','title'=>'通证价格','name'=>'is_tongprice','help'=>'每天自己获得的广告值数量÷通证价格=获得通证个数'),
					array('type'=>'switch','title'=>'分销商是否需要审核','name'=>'become_check','isradio'=>'1'),
					array('type'=>'switch','title'=>'是否需要完善资料','name'=>'isinfo','isradio'=>'1'),
					array('type'=>'switch','title'=>'关闭跳转商城地址','name'=>'no_indexurl'),
					array('type'=>'link','from'=>'action','title'=>'品牌代理跳转商城地址','name'=>'index_url'),
				)
			),
			array(
				'title'=>'结算设置',
				'list'=>array(
					array('type'=>'switch','title'=>'下单即可结算','name'=>'is_jiesuan','help'=>'不用等完成订单，就可以结算！'),
					array('type'=>'checkbox','title'=>'支持的提现方式','name'=>'withdrawtype','options'=>'withdraw'),
					array('type'=>'string','title'=>'分红打款手续费（%）','name'=>'balance_per'),
					array('type'=>'radio','title'=>'分红计算方式','name'=>'commissiontype','options'=>'commissiontype','help'=>''),
					array('type'=>'unitstring','unit'=>'元','title'=>'多少金额才能结算','name'=>'balance_money'),
					array('type'=>'string','title'=>'免手续费提现区间开始金额','name'=>'balance_money_start'),
					array('type'=>'string','title'=>'免手续费提现区间结束金额','name'=>'balance_money_end','help'=>'当提现手续费金额在此区间内时,不扣除提现手续费. 结束金额 必须大于 开始金额才能生效'),
					array('type'=>'string','title'=>'结算天数','name'=>'balance_day','help'=>'当订单完成后的n天后，订单才能申请结算,设置0或空，订单完成就可以结算'),
				),
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
		)
	);
	$return['leveltype']=$this->level_up_types;
	$return['agent_types']=$this->agent_types;
	$return['commissiontype']=$this->commission_types;
	$return['become']=array('1'=>'后台指定','2'=>'申请','3'=>'无条件','4'=>'消费金额');
	$return['level']=$this->level_types;
	$return['gift_type']=$this->gift_type;
	$return['withdraw']=$this->pay_types;
	$return['htmls']=$htmls;
	exi($return);
}


